#include <signal.h>
#include <stdio.h>
#include <unistd.h>

void fun(int, siginfo_t *, void *);

int main(int argc, const char *agrv[]) {
  printf("my pid is %d\n", getpid());

  struct sigaction act;
  act.sa_flags = SA_SIGINFO;
  act.sa_sigaction = fun;
  sigaction(2, &act, NULL);
  pause();

  return 0;
}

void fun(int num, siginfo_t *buf, void *data) {
  printf("cat signal is %d\n",num);
  printf("data = %d\n",buf->si_int);
}
